package com.ydd.mapper;

import com.ydd.entity.RoleMenu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 * 角色-菜单 Mapper 接口
 * </p>
 *
 * @author hgz
 * @since 2023-05-30
 */
@Mapper
public interface RoleMenuMapper extends BaseMapper<RoleMenu> {

    @Select("select menu_id from sys_role_menu where role_id = #{roleId}")
    List<Integer> findMenuIdByRoleId(String roleId);
    @Delete("delete from sys_role_menu where role_id = #{id} ")
    void deleteByID(String id);

    @Select("select menu_id from sys_role_menu where role_id= #{id}")
    List<String> selectRoleAllmeanu(String id);

    @Insert("insert into sys_role_menu" +
            " (role_id,menu_id) values (#{id},#{menuId})")
    void insertB(@Param("id") String id, @Param("menuId") Integer menuid);

    @Select("select role_id, menu_id from sys_role_menu where role_id = #{id}")
    List<RoleMenu> findByid(String id);

    @Delete("delete from sys_role_menu where role_id=#{id}}")
    void deleteByRoleId(String id);
}
